package main

import (
	"fmt"
	"gorm-gen-demo/dal"

	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

const MySQLDSN = "root:root@(localhost:3306)/test?charset=utf8mb4&parseTime=True&loc=Local"

func main() {
	// 连接数据库
	db, err := gorm.Open(mysql.Open(MySQLDSN))
	if err != nil {
		panic(fmt.Errorf("cannot establish db connection: %w", err))
	}
	dal.SetDefault(db)
	userDo := dal.User.Where(dal.User.Age.Eq(18))
	fmt.Print(userDo)
}
